package com.qf.hospital.mapper;

import com.qf.hospital.entity.SysRole;
import com.qf.hospital.entity.SysRoleExample;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface SysRoleMapper {
    long countByExample(SysRoleExample example);

    int deleteByExample(SysRoleExample example);

    int deleteByPrimaryKey(Integer roleId);

    int insert(SysRole record);

    int insertSelective(SysRole record);

    List<SysRole> selectByExample(SysRoleExample example);

    SysRole selectByPrimaryKey(Integer roleId);

    int updateByExampleSelective(@Param("record") SysRole record, @Param("example") SysRoleExample example);

    int updateByExample(@Param("record") SysRole record, @Param("example") SysRoleExample example);

    int updateByPrimaryKeySelective(SysRole record);

    int updateByPrimaryKey(SysRole record);

    @Select(value = "SELECT mid FROM sys_role_menu WHERE rid = #{roleid}")
    List<Integer> findMenuByRoleId(@Param("roleid") Integer roleid);

    int insertRoleMenu(@Param("roleid") Integer roleid, @Param("ids") Integer[] ids);

    @Delete("DELETE FROM sys_role_menu WHERE rid = #{roleid}")
    void deleteRoleMenuByRoleId(@Param("roleid") Integer roleid);
}